<?php
class Muserimg extends CI_Model{
	function __construct(){
		parent::__construct();
	}

	function getUserImg(){
		$arr = array();
		$sql = "select * from tbuserimg where id = 1";
		$query = $this->db->query($sql);
		foreach ($query->result() as $row){
			$arr["id"] = $row->id;
			$arr["sh"] = $row->sh;
			$arr["shurl"] = $row->shurl;
			$arr["shisvalid"] = $row->shisvalid;
			$arr["mt"] = $row->mt;
			$arr["mturl"] = $row->mturl;
			$arr["mtisvalid"] = $row->mtisvalid;
			$arr["sy"] = $row->sy;
			$arr["syurl"] = $row->syurl;
			$arr["syisvalid"] = $row->syisvalid;
			$arr["hy"] = $row->hy;
			$arr["hyurl"] = $row->hyurl;
			$arr["hyisvalid"] = $row->hyisvalid;
			$arr["rz"] = $row->rz;
			$arr["rzurl"] = $row->rzurl;
			$arr["rzisvalid"] = $row->rzisvalid;
		}
		return $arr;
	}

    function getUserIcon($uid)
    {
        $iconIdArr = $this->Musericon->getUserIconId($uid);
        $userImg = $this->getUserImg();
        $item = array();
        if(!empty($iconIdArr)){
            foreach($iconIdArr as $value){
                switch($value['icon_id']){
                    case 1:
                        $userImg['shisvalid'] == 1 && $item[] = array('name'=>$userImg['sh'],'url'=>$userImg['shurl']);
                        break;
                    case 2:
                        $userImg['mtisvalid'] == 1 && $item[] = array('name'=>$userImg['mt'],'url'=>$userImg['mturl']);
                        break;
                    case 3:
                        $userImg['syisvalid'] == 1 && $item[] = array('name'=>$userImg['sy'],'url'=>$userImg['syurl']);
                        break;
                    case 4:
                        $userImg['hyisvalid'] == 1 && $item[] = array('name'=>$userImg['hy'],'url'=>$userImg['hyurl']);
                        break;
                    case 5:
                        $userImg['rzisvalid'] == 1 && $item[] = array('name'=>$userImg['rz'],'url'=>$userImg['rzurl']);
                        break;
                }
            }
        }
        return $item;
    }
}
?>